﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChangePassword.aspx.cs" Inherits="ChangePassword"
    MasterPageFile="~/Mobile.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <form id="Form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
    </asp:ScriptManager>
    <section>

<section>
<header id="header">
<nav id="nav">
<a href="default.aspx"><div class="branding"></div></a>
<div class="nav">
<a href="quote.aspx">
<asp:Image ID="imgTop" runat="server" ImageUrl="<%$Resources:CarInsurance,TopNavBack%>" Width="49" Height="29" AlternateText="Start" BorderWidth="0" />
</a>
</div>
</nav>
</header>
</section>
<section id="body">
<div class="body">
<div class="pad">
<div class="form white">
 <h5><asp:Label runat="server" ID="lblChangePassword" Text="<%$Resources:Menu,ChangePassword%>" />:</h5>
 <asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label>
<asp:ValidationSummary ID="ValidationSummary1" CssClass="errorSummary" HeaderText="<%$ Resources:Menu,RequiredField%>" runat="server" ValidationGroup="customer" />
<!-- Form | Start   -->
<asp:Panel runat="server" ID="pnlChangePassword" DefaultButton="btnSubmit">
<%=GetGlobalResourceObject("Menu", "CurrentPassword")%>
<br />
<asp:TextBox ID="txtOldPassword" runat="server" TextMode="Password" MaxLength="20" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvOldPassword" runat="server" ControlToValidate="txtOldPassword" validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:RequiredFieldValidator>
<br />
<%=GetGlobalResourceObject("Menu", "NewPassword")%>
<br /><asp:TextBox ID="txtNewPassword" TextMode="Password" runat="server" MaxLength="20" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvNewPassword" runat="server" ControlToValidate="txtNewPassword" validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:RequiredFieldValidator>
<br />
<%=GetGlobalResourceObject("Menu", "ConfirmPassword")%>
<br />
<asp:TextBox ID="txtConfirmPassword" TextMode="Password" runat="server" MaxLength="20" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvConfirmPassword" runat="server" ControlToValidate="txtConfirmPassword" validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="csvConfirmPassword" runat="server" ControlToCompare="txtNewPassword" validationErrorCssClass="validationError" ControlToValidate="txtConfirmPassword" Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:CompareValidator>
<br />
 <%=GetGlobalResourceObject("Menu", "SecurityCheck")%>
 <br />
<asp:UpdatePanel runat="server" ID="uplCAPCHA">
                                                    <ContentTemplate>
                                                        <div style="display: block;">
                                                            <asp:Image ID="imgCAPTCHA" ImageUrl="/captcha/frmJpegImage.aspx" runat="server" AlternateText="captcha" />
                                                        </div>
                                                        <asp:ImageButton ID="btnNewImage" runat="server" OnClick="btnNewImage_Click" ImageUrl="images/icon/refresh.gif"
                                                            ToolTip="Reload" AlternateText="Refresh" />
                                                        <%--<asp:Label ID="Label1" Text="" runat="server"></asp:Label>--%>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                                <asp:UpdateProgress AssociatedUpdatePanelID="uplCAPCHA" DisplayAfter="100" runat="server"
                                                    ID="udpCAPTCHA">
                                                    <ProgressTemplate>
                                                        <img src="images/loader/small_loading.gif" alt="Loading..." width="30" height="20" /><br />
                                                    </ProgressTemplate>
                                                </asp:UpdateProgress>
<br />
 <%=GetGlobalResourceObject("Menu", "TextinBox")%>
 <br />
 <asp:UpdatePanel ID="uplSecurityCode" runat="server">
<ContentTemplate>
<span class="indicator">
<asp:TextBox ID="txtSecurityCode" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvSecurityCheck" runat="server" ControlToValidate="txtSecurityCode"
validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
ValidationGroup="customer"></asp:RequiredFieldValidator>
</span>
</ContentTemplate>
</asp:UpdatePanel>
<br />
 <asp:Button ID="btnSubmit" CssClass="button_changepassword" runat="server" OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('customer')){this.className = 'button_processingLong';}" OnClick="btnSubmit_Click" ValidationGroup="customer" /> 
</asp:Panel>
<!-- Form | End   -->
</div>
</div>
</div>
</section>
    </form>

    <script type="text/javascript">
        function CheckPasswordLength(source, arguments) {
            //var corglen = arguments.Value;
            var cval = arguments.Value;
            var bValid = true;
            var chList = new Array(20);
            var ctrlsource = document.getElementById(source.id);

            //alert("ORG LEN : " + corglen.length + " AFTER : " + cval.length);
            if (cval.indexOf(' ') != -1 || cval.indexOf('\'') != -1
                        || cval.indexOf('\"') != -1 || cval.indexOf('~') != -1) {
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password include invalid character or space!";
                }
                else {
                    ctrlsource.innerText = "Password include invalid character or space!";
                }

                ctrlsource.errormessage = "Password include invalid character or space!";
                bValid = false;
            }
            else if (cval.length < 6) {
                //ctrlsource.innerText = "Password length should be at least 6";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should be at least 6";
                }
                else {
                    ctrlsource.innerText = "Password length should be at least 6";
                }

                ctrlsource.errormessage = "Password length should be at least 6";
                bValid = false;
            }
            else if (cval.length > 20) {
                bValid = false;
                //ctrlsource.innerText = "Password length should not be over 20!";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should not be over 20!";
                }
                else {
                    ctrlsource.innerText = "Password length should not be over 20!";
                }
                ctrlsource.errormessage = "Password length should not be over 20!";
            }
            else {
                bValid = true;
            }
            //alert(cval);
            //if (isNaN(cval)){
            //    bValid = false;
            //} 


            //alert(bValid);
            arguments.IsValid = bValid;
            return;
        }
        
        
    </script>

</asp:Content>
